<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>选择支付方式</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 20px;
        }
        .container {
            max-width: 400px;
            margin: auto;
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        h2 {
            text-align: center;
        }
        .payment-option {
            display: flex;
            align-items: center;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        .payment-option:hover {
            background-color: #f0f0f0;
        }
        .payment-option img {
            width: 30px;
            height: 30px;
            margin-right: 10px;
        }
        .selected {
            border-color: #4CAF50;
            background-color: #e8f5e9;
        }
        button {
            width: 100%;
            padding: 10px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            visibility: hidden;  /* 隐藏按钮，但仍占据空间 */
        }
        button:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>

<div class="container">
    <h2>选择支付方式</h2>
    <div class="payment-option" onclick="selectPayment(this)">
        <img src="alipay_logo.png" alt="支付宝"> <!-- 使用本地文件 -->
        <span>支付宝</span>
    </div>
    <div class="payment-option" onclick="selectPayment(this)">
        <img src="wechat_logo.png" alt="微信支付"> <!-- 需要下载并替换 -->
        <span>微信支付</span>
    </div>
    <div class="payment-option" onclick="selectPayment(this)">
        <img src="unionpay_logo.png" alt="银联支付"> <!-- 需要下载并替换 -->
        <span>银联支付</span>
    </div>
    <button   onclick="confirmPayment()">确认支付</button>
</div>

<script>
    function selectPayment(element) {
        const options = document.querySelectorAll('.payment-option');
        options.forEach(option => option.classList.remove('selected'));
        element.classList.add('selected');
    }

    function confirmPayment() {
        const selected = document.querySelector('.payment-option.selected');
        if (selected) {
            alert('已选择支付方式: ' + selected.innerText);
        } else {
            alert('请先选择支付方式');
        }
    }
</script>

</body>
</html>
